<template>
  <div id="app">
    <h1 align="center">申诉内容</h1><br>
    <el-input
      type="textarea"
      :rows="8"
      placeholder="请输入内容"
      v-model="content"
      class="complaint">
    </el-input><br>
    <el-button type="primary" @click="Debate">
      提交申诉
    </el-button>
  </div>
</template>

<script>
import axios from 'axios'
import router from '../../router'

export default {
  name: 'Debate',
  data () {
    return {
      content: ''
    }
  },
  methods: {
    Debate: function () {
      // alert(this.content)
      if (this.content === '') {
        alert('请输入申诉内容')
      } else {
        axios.post(`user/personal/debate`, {
          task_id: '0',
          content: this.content
        }).then(res => {
          if (res.data.status === 100) {
            alert(res.data.data.msg)
            return this.$router.push({
              path: '/index'
            })
          } else {
            alert('提交失败')
          }
        }).catch(err => {
          alert(err)
          router.replace('/login')
        })
      }
    }
  }
}
</script>

<style scoped>
.complaint{
  text-align: center;
  height: 350px;
  margin: 30px auto;
  width: 600px;
}
</style>
